<template>
  <div class="header">
    <div class="title">
      <div class="iconPosit" @click.stop="pushGo">
        <i v-if="icon" class="el-icon-arrow-left"></i>
        <div v-else></div>返回
      </div>
      <div>{{ name }}</div>
      <div class="iconPosit2" @click.stop="pushhome">
        <i class="el-icon-s-home"></i>首页
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    name: {
      type: String,
      default: ''
    },
    icon: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    pushGo () {
      this.$router.go(-1)
    },
    pushhome() {
      this.$router.push({ path: '/' })
    }
  }
}
</script>

<style scoped lang="scss">
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  .title {
    padding: 15px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e9fff;
    color: #FFF;
    letter-spacing: 3px;
    font-size: 24px;
    font-weight: bold;
    i {
      font-weight: bold;
    }
  }
}
</style>
